package com.horsen.service.user.service.feign;

import com.horsen.common.util.R;
import com.horsen.service.base.model.VO.WebCourseOrderVO;
import com.horsen.service.user.service.feign.fallback.EduCourseServiceFallBack;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;

/**
 * 调用edu微服务的Course控制器
 *
 * @author Horsen
 */
@Service
@FeignClient(value = "service-edu", fallback = EduCourseServiceFallBack.class)
public interface EduCourseService {
    /**
     * 根据ID获取一个课程订单VO
     *
     * @param id 课程ID
     * @return 课程订单VO
     */
    @GetMapping("/web/edu/courses/order/{id}")
    WebCourseOrderVO getCourseOrderById(@PathVariable String id);

    /**
     * 根据ID增加课程销量
     * @param id 课程ID
     * @return 统一返回结果实例
     */
    @PutMapping("/web/edu/courses/{id}")
    R addBuyCount(@PathVariable String id);
}
